import { http, HttpResponse } from 'msw'

// 新建项目
export const newProject = http.get('/data/ed/prj/create', () => {
  return HttpResponse.json({
    errorCode: 0,
    errorMessage: '',
    data: true,
    success: true,
  })
})
// 获取所有项目
export const getAllProject = http.get('/data/ed/prj/queryAll', () => {
  return HttpResponse.json({
    errorCode: 200,
    errorMessage: '',
    success: true,
    data: [
      {
        id: '100001',
        title: 'C919',
        publishedStatus: 1,
        parentId: '0',
        sort: 1,
        children: [
          {
            id: '100002',
            title: 'mymymymtest初步设计',
            parentId: '100001',
            sort: 1,
            children: [
              {
                id: '100005',
                title: 'HIRF',
                parentId: '100002',
                sort: 1,
                children: [],
              },
              {
                id: '100006',
                title: '雷电',
                parentId: '100002',
                sort: 2,
                children: [],
              },
            ],
          },
          {
            id: '100003',
            title: '立项设计',
            parentId: '100001',
            sort: 2,
            children: [],
          },
          {
            id: '100004',
            title: '详细wwwww设计阶段',
            parentId: '100001',
            sort: 3,
            children: [],
          },
        ],
      },
      {
        id: '100022',
        title: 'C929',
        publishedStatus: 0,
        parentId: '0',
        sort: 1,
        children: [
          {
            id: '100012',
            title: '初xxxx步设计',
            parentId: '100022',
            sort: 1,
            children: [
              {
                id: '100005',
                title: 'HIRF',
                parentId: '100012',
                sort: 1,
                children: [],
              },
              {
                id: '100006',
                title: '雷电',
                parentId: '100012',
                sort: 2,
                children: [],
              },
            ],
          },
          {
            id: '100003',
            title: '立项设计',
            parentId: '100022',
            sort: 2,
            children: [
              {
                id: '100010',
                title: 'test1',
                parentId: '100003',
                sort: 1,
                children: [],
              },
              {
                id: '100011',
                title: 'test2',
                parentId: '100003',
                sort: 2,
                children: [],
              },
            ],
          },
          {
            id: '100004',
            title: '详细设计阶段',
            parentId: '100022',
            sort: 3,
            children: [],
          },
        ],
      },
      {
        id: '100023',
        title: 'C939',
        publishedStatus: 0,
        parentId: '0',
        sort: 1,
        children: [
          {
            id: '110012',
            title: '初xxxx步设计',
            parentId: '100023',
            sort: 1,
          },
          {
            id: '110004',
            title: '详细设计阶段',
            parentId: '100023',
            sort: 3,
            children: [],
          },
        ],
      },
    ],
  })
})
// 删除项目
export const deleteProject = http.get('/data/ed/prj/delete', () => {
  return HttpResponse.json({
    errorCode: 0,
    errorMessage: '',
    data: true,
    success: true,
  })
})
// 删除子集
export const deleteProjectNode = http.get('/data/ed/prj/deleteFolder', () => {
  return HttpResponse.json({
    errorCode: 200,
    errorMessage: '',
    data: '11111',
    success: true,
  })
})
// 修改项目名称
export const renameProject = http.get('/data/ed/prj/modify', () => {
  return HttpResponse.json({
    errorCode: 200,
    errorMessage: '',
    data: true,
    success: true,
  })
})
// 发布项目
export const publishProject = http.get('/data/ed/prj/publish', () => {
  return HttpResponse.json({
    errorCode: 200,
    errorMessage: '',
    data: true,
    success: true,
  })
})

// 沿用项目
export const useProject = http.get('/data/ed/prj/follow', () => {
  return HttpResponse.json({
    errorCode: 200,
    errorMessage: '',
    data: true,
    success: true,
  })
})

// 新建子集
export const addNode = http.get('/data/ed/prj/addFolder', () => {
  return HttpResponse.json({
    errorCode: 200,
    errorMessage: '',
    data: '11111',
    success: true,
  })
})

// 修改子集名称
export const renameNode = http.get('/data/ed/prj/modifyFolder', () => {
  return HttpResponse.json({
    errorCode: 200,
    errorMessage: '',
    data: true,
    success: true,
  })
})

// 子集重排序
export const folderResort = http.post('/data/ed/prj/folderResort', () => {
  return HttpResponse.json({
    errorCode: 200,
    errorMessage: '',
    data: true,
    success: true,
  })
})
// 获取项目发布状态
export const getPrjStatus = http.post('/data/ed/prj/publishStatus', () => {
  return HttpResponse.json({
    errorCode: 200,
    errorMessage: '',
    data: { 100001: 1, 100022: 0, 100023: 1 },
    success: true,
  })
})
